<!doctype html>
<html class="no-js fixed-layout">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>后台管理系统</title>
    <meta name="description" content="后台管理系统">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="viewport" content="width=device-width, initial-scale=0.3, maximum-scale=0.9, minimum-scale=0.3, user-scalable=yes"  />

    <link rel="icon" type="image/png" href="__ADMIN__/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="__ADMIN__/i/app-icon72x72@2x.png">

    <link rel="stylesheet" href="__ADMIN__/css/amazeui.min.css"/>
    <link rel="stylesheet" href="__ADMIN__/css/admin.css">
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
    以获得更好的体验！</p>
<![endif]-->

<header class="am-topbar am-topbar-inverse admin-header">
    <div class="am-topbar-brand">
        <strong></strong> <small>后台管理系统</small>
    </div>

    <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>

    <div class="am-collapse am-topbar-collapse" id="topbar-collapse">

        <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list">
            <li class="am-dropdown" data-am-dropdown>
                <a class="am-dropdown-toggle" data-am-dropdown-toggle href="javascript:;">
                    <span class="am-icon-users"></span> <php>echo session('Admin_yctr')['truename'] </php> <span class="am-icon-caret-down"></span>
                </a>
                <ul class="am-dropdown-content">
                    <!--<li><a href="#"><span class="am-icon-user"></span> 资料</a></li>-->
                    <!--<li><a href="#"><span class="am-icon-cog"></span> 设置</a></li>-->
                    <li><a href="{:U('Admin/change_password')}"><span class="am-icon-power-off"></span> 修改密码</a></li>

                    <li><a href="{:U('Public/getOut')}"><span class="am-icon-power-off"></span> 退出</a></li>
                </ul>
            </li>
            <li class="am-hide-sm-only"><a href="javascript:;" id="admin-fullscreen"><span class="am-icon-arrows-alt"></span> <span class="admin-fullText">开启全屏</span></a></li>
        </ul>
    </div>
</header>

<div class="am-cf admin-main">
    <!-- sidebar start -->
    <div class="admin-sidebar am-offcanvas" id="admin-offcanvas">
        <div class="am-offcanvas-bar admin-offcanvas-bar">
            <ul class="am-list admin-sidebar-list">
                <li><a href="{:U('Index/index')}"><span class="am-icon-home"></span>控制台</a></li>
                <volist name="admin_menu" id="vo">
                <li class="admin-parent">
                    <!--{target: '#collapse-nav-{$key}'}-->
                    <if condition="$key eq 0 || $key eq 4">
                        <a class="am-cf parent_menu" data="{$key}" data-am-collapse=""><span class="am-icon-file"></span> {$vo['name']} <span class="am-icon-angle-right am-fr am-margin-right"></span></a>
                        <else/>
                        <a class="am-cf" data-am-collapse="{target: '#collapse-nav-{$key}'}"><span class="am-icon-file"></span> {$vo['name']} <span class="am-icon-angle-right am-fr am-margin-right"></span></a>

                    </if>
                    <ul class="am-list am-collapse admin-sidebar-sub" id="collapse-nav-{$key}">
                        <volist name="vo['children_menu']" id="vv">
                            <if condition="$vv['url'] eq 'user/userList'">
                                <li><a href="#" onclick="menu_url();" class="am-cf user_url" url="__APP__/{$vv['url']}"><span class="am-icon-check"></span> {$vv['name']}<span class="am-icon-star am-fr am-margin-right admin-icon-yellow"></span></a></li>

                                <else/>
                                <li><a href="__APP__/{$vv['url']}" class="am-cf"><span class="am-icon-check"></span> {$vv['name']}<span class="am-icon-star am-fr am-margin-right admin-icon-yellow"></span></a></li>

                            </if>

                        </volist>
                    </ul>
                </li>
                </volist>
                <!--<li class="admin-parent">-->
                    <!--<a class="am-cf" data-am-collapse="{target: '#collapse-nav_'}"><span class="am-icon-file"></span> 菜单管理 <span class="am-icon-angle-right am-fr am-margin-right"></span></a>-->
                    <!--<ul class="am-list am-collapse admin-sidebar-sub am-in" id="collapse-nav_">-->
                        <!--<li><a href="{:U('Menu/menulist')}" class="am-cf"><span class="am-icon-check"></span> 菜单列表<span class="am-icon-star am-fr am-margin-right admin-icon-yellow"></span></a></li>-->
                        <!--<li><a href="{:U('Menu/add_menu')}" class="am-cf"><span class="am-icon-check"></span> 新增菜单<span class="am-icon-star am-fr am-margin-right admin-icon-yellow"></span></a></li>-->

                    <!--</ul>-->
                <!--</li>-->
            </ul>

        </div>
    </div>
    <!-- sidebar end -->

    <!-- content start -->
    <block name="content"></block>
    <!--<footer class="admin-content-footer">-->
        <!--<hr>-->
        <!--<p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>-->
    <!--</footer>-->
    <!-- content end -->

</div>

<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>

<!--[if lt IE 9]>
<script src="__PUBLIC__/common/js/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="__ADMIN__/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="__ADMIN__/js/jquery.min.js"></script>
<script src="__LIB__/97date/WdatePicker.js"></script>

<!--<![endif]-->
<script src="__ADMIN__/js/amazeui.min.js"></script>
<script src="__ADMIN__/js/app.js"></script>

<script src="__PUBLIC__/lib/layer/layer.js"></script>
<!--<script src="__COMMON__/js/common.js"></script>-->
<!-- 引入js -->

<script type="text/javascript" src="/Public/Home/js/web3.1.js"></script>
<script>
$(document).on("click",".parent_menu",function(){
    var that = $(this)
    var key = that.attr('data')
    layer.prompt({title:'输入密码'},function(val,index){
        $.post("{:U('Public/verify_password')}",{password:val},function (data) {

                    if(data.code>0){
                        layer.msg('验证成功',{time:1000},function () {
                            // window.location.href=url;
                            that.attr("data-am-collapse","{target: '#collapse-nav-"+key+"'}")
                            that.siblings("ul").addClass('am-in')
                            that.removeClass("parent_menu")
                            layer.close(index)
                        });return false;
                    }else{layer.msg(data.msg,{time:1000});return false; }
                },'json')
        
    })
})
    function menu_url() {
        layer.open({
            type: 1,
            title:'输入密码',
            skin:'layui-layer-rim',
            area:['450px', 'auto'],
            content: ' <div class="row" style="width: 420px;  margin-left:7px; margin-top:10px;">'
                +'<div class="col-sm-12">'
                +'<div class="input-group">'
                +'<input id="password" style="width: 100%" class="form-control"/>'
                // +'<textarea id="beizhu" style="width: 100%" class="form-control" >'
                // +'</textarea>'
                +'</div>'
                +'</div>'
                +'</div>'
            ,
            btn:['提交','取消'],
            btn1: function (index,layero) {
                var password = $('#password').val();
                var url=$('.user_url').attr('url');
                $.post("{:U('Public/verify_password')}",{password:password},function (data) {

                    if(data.code>0){
                        layer.msg('验证成功',{time:1000},function () {
                            window.location.href=url;
                        });return false;
                    }else{layer.msg(data.msg,{time:1000});return false; }
                },'json')
            },
            btn2:function (index,layero) {
                layer.close(index);
            }
        });
    }
    if (typeof web3 !== 'undefined') {
        web3 = new Web3(web3.currentProvider);
    }
    else {
        web3 = new Web3('https://mainnet.infura.io/JLEYzEEavNnSni91CvPF');
    }

    //定时执行
    // setInterval(function(){
    //     // console.log(data.msg);return false;
    //     //传送数据
    //     $.ajax({
    //         type: 'POST',
    //         url: '{:U("Public/autoWithdrawETH")}',
    //         data: {
    //             // 'txhash': 1,
    //             // 'id' : 2
    //         },
    //         dataType: 'json',
    //         success: function(data){
    //             //提币失败
    //             if (data.code == 0) {
    //                 // console.log(data.msg);
    //                 var name=data.msg.coinname;
    //                 if(name==="btc"){
    //                     $.ajax({
    //                         type: 'POST',
    //                         url: '{:U("doWithdrawBTC")}',
    //                         data: {
    //                             'id':data.msg.id
    //                         },
    //                         dataType: 'json',
    //                         success: function(data){
    //                             if (data.code == 0) {
    //                                 console.log(data.msg);
    //                                 // window.location.reload();
    //                                 return;
    //                             } else {
    //                                 console.log(data.msg);
    //                                 // window.location.reload();
    //                                 // window.location ="{:U('withdrawCoin')}";
    //                             }
    //
    //                         }
    //                     });
    //                 }else{
    //                     // console.log(data.msg);
    //                     // alert(data.msg);
    //                     // window.location.reload();
    //                     // window.location ="{:U('withdrawCoin')}";
    //                     var from =data.msg.from;
    //                     var amount =data.msg.amount;//提币金额
    //                     var to = data.msg.address;//提币地址
    //                     var id = data.msg.id;//id
    //                     //验证数量
    //
    //                     if(!web3.utils.isAddress(to)){
    //                         console.log('钱包地址不正确');
    //                         return false;
    //                     }
    //                     console.log(data.msg);
    //                     web3.eth.getTransactionCount(from, function(err, count){
    //
    //                         if(!err){
    //                             var tcount = count;
    //                             wfxContract.methods.balanceOf(from).call( function(err, tkns){
    //                                 if (!err) {
    //                                     var balance = web3.utils.fromWei(tkns, 'ether');
    //                                     console.log(balance);
    //                                     var b = new web3.utils.BN(balance)
    //
    //                                     if(b.toNumber() < amount){
    //                                         console.log('平台钱包WFX余额不足');
    //                                         return false;
    //                                     }
    //
    //                                     amount = web3.utils.toWei(amount.toString());
    //
    //                                     web3.eth.getGasPrice().then(function(gasPrice){
    //
    //                                         var rawTransaction = {
    //                                             "from": from,
    //                                             "nonce": "0x" + tcount.toString(16),
    //                                             "gasPrice": web3.utils.toHex(gasPrice),
    //                                             "gasLimit": web3.utils.toHex(60000),
    //                                             "to": wfxContractAddress,
    //                                             "value": "0x0",
    //                                             "data": wfxContract.methods.transfer(to, amount).encodeABI()
    //                                         };
    //
    //                                         // var privKey = '0x54C9FC6CF41F649863E6AFAC511E418D7A70E814814598FE5C6634326DCEC791';
    //                                         // var privKey = privKey;
    //                                         var privKey = data.msg.key;
    //
    //
    //                                         web3.eth.accounts.signTransaction(rawTransaction, privKey, function(err,signed){
    //
    //                                             if(err){
    //                                                 console.log(err);
    //                                                 return ;
    //                                             }
    //                                             web3.eth.sendSignedTransaction(signed.rawTransaction, function(err, result){
    //                                                 if(!err){
    //
    //                                                     //传送数据
    //                                                     $.ajax({
    //                                                         type: 'POST',
    //                                                         url: '{:U("User/doWithdrawETH")}',
    //                                                         data: {
    //                                                             'txhash': result,
    //                                                             'id' : id
    //                                                         },
    //                                                         dataType: 'json',
    //
    //                                                         success: function(data){
    //                                                             //提币失败
    //                                                             if (data.code == 0) {
    //                                                                 console.log(data.msg);
    //                                                                 // alert(data.msg);
    //                                                                 // window.location.reload();
    //                                                                 // window.location ="{:U('withdrawCoin')}";
    //                                                             } else {
    //                                                                 console.log(data.msg);
    //                                                                 $(".auto_value").text(data.msg);
    //                                                                 // alert(data.msg);
    //                                                                 // window.location.reload();
    //                                                                 // return;
    //                                                             }
    //
    //                                                         }
    //                                                     });
    //                                                 }else{
    //                                                     console.log(err);
    //                                                 }
    //                                             })
    //                                         })
    //
    //                                     })
    //
    //                                 }else{
    //                                     console.log(err)
    //                                 }
    //
    //                             })
    //                         }else{
    //                             console.log(error);
    //                         }
    //
    //                     });
    //                 }
    //
    //             } else {
    //                 console.log(data.msg);
    //                 $(".auto_value").text(data.msg);
    //                 // alert(data.msg);
    //                 // window.location.reload();
    //                 // return;
    //             }
    //
    //         }
    //     });
    // },100000);
</script>

<block name="js"></block>
</body>
</html>
